-- Database: XchUserInfo
-- Table: XchUserInfo

IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[XchUserInfo]') AND type in (N'U'))
BEGIN
    CREATE TABLE [dbo].[XchUserInfo]
    (
        [XchUserID]       INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
        [XchUserName]     NVARCHAR(20)  NOT NULL,
        [XchPassword]     NVARCHAR(50)  NOT NULL,
        [XchEmail]        NVARCHAR(100) NULL,
        [XchPhone]        NVARCHAR(15)  NULL,
        [XchAddress]      NVARCHAR(100) NULL,
        [XchRegDateTime]  DATETIME      NOT NULL CONSTRAINT DF_XchUserInfo_RegDateTime DEFAULT (GETDATE())
    );
END
GO

-- Seed 5 rows (one should be your own info; replace as needed)
IF NOT EXISTS (SELECT 1 FROM [dbo].[XchUserInfo])
BEGIN
    INSERT INTO [dbo].[XchUserInfo] ([XchUserName],[XchPassword],[XchEmail],[XchPhone],[XchAddress]) VALUES
    (N'Xch_Test1', N'Pass@123', N'Xch_test1@example.com', N'13800000001', N'Address 1'),
    (N'Xch_Test2', N'Pass@123', N'Xch_test2@example.com', N'13800000002', N'Address 2'),
    (N'Xch_Test3', N'Pass@123', N'own_email@example.com', N'13800000003', N'My Address'),
    (N'Xch_Test4', N'Pass@123', N'Xch_test4@example.com', N'13800000004', N'Address 4'),
    (N'Xch_Test5', N'Pass@123', N'Xch_test5@example.com', N'13800000005', N'Address 5');
END
GO



